"""
WebSocket路由
处理实时协作的WebSocket连接
"""

from fastapi import APIRouter, WebSocket, Query, Depends
from src.services.websocket_service import websocket_service
from src.utils.logging import get_logger

logger = get_logger(__name__)

router = APIRouter(prefix="/ws", tags=["实时协作"])

@router.websocket("/collaborate")
async def websocket_collaborate(
    websocket: WebSocket,
    session_id: str = Query(..., description="会话ID"),
    user_id: str = Query(..., description="用户ID")
):
    """
    WebSocket实时协作端点
    
    Args:
        websocket: WebSocket连接对象
        session_id: 会话ID
        user_id: 用户ID
    """
    await websocket_service.handle_websocket_connection(
        websocket, 
        session_id, 
        user_id, 
        {"user_id": user_id}
    )